#include "widget.h"
#include "ui_widget.h"
#include <QPainter>
#include <QPixmap>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

//    QPixmap pix(500, 500);
//    QPainter painter(&pix);
//    painter.setPen(Qt::red); // 设置画笔颜色

//    painter.drawEllipse(QPoint(100, 100),100, 100); // 画圆
//    pix.save("D:/C++/qt-learning/Scode/learn9-Painter-tools/pix.png");


    QImage img(500, 500, QImage::Format_RGB32);
    img.fill(Qt::white); // 填充色：白色，默认为黑色
    QPainter painter(&img);
    painter.drawEllipse(QPoint(100, 100),100, 100); // 画圆
    img.save("D:/C++/qt-learning/Scode/learn9-Painter-tools/img.jpg");
}

Widget::~Widget()
{
    delete ui;
}

